package com.ssm.utils;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

/**
 * 密码加密
 */
public class BCryptPasswordEncoderUtils {

    private static BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
    public static String encodePassword(String password){
        return bCryptPasswordEncoder.encode(password);
    }

    public static void main(String[] args) {
        String password="123";
        String pwd = encodePassword(password);

        System.out.println(pwd);
        //$2a$10$UIFFSrbWjQFcSdoKMltry.wtcQJIUCG8CNDozHtcMBFd6AGr8lWKi
        System.out.print(pwd.length());
    }
}
